home *** CD-ROM | disk | FTP | other *** search
- // Path needs to be relative link from page that called this script
- Image1 = new Image();
- Image1.src = "../../../Images/heasarc/icons/blank2.gif";
- Image2 = new Image();
- Image2.src = "../../../Images/heasarc/icons/star2.gif";
-
- total = 3;
-
- yourAnswer = new Array(total);
- answer = new Array("B","B", "B");
-
- function Swap(start, end) {
- for (i = start; i <= end; i++) {
- document.images["correct" + i].src = Image2.src;
- }
- return true;
- }
-
-
- function AssignClick(letter, position) {
- yourAnswer[position] = letter.value;
- }
-
- function CheckMe() {
-
- var count = 0;
-
- for (i = 0; i < total; i++) {
- if (yourAnswer[i] == answer[i]) {count++;}
- }
-
- Swap(1, total);
-
- var win = window.open("", "score_window", "width=300,height=300, resizable=yes,scrollbars=yes");
-
- win.document.write('<HTML>\n<HEAD>\n<TITLE>Your Score</TITLE>\n</HEAD>\n');
- win.document.write('<BODY BGCOLOR="#FFFFFF" TEXT="#000094" LINK="#7D5F00"'); win.document.write(' VLINK="#9E0A42" ALINK="#FF0000">');
- win.document.write('<H2 ALIGN="CENTER">');
-
- if (count == total) {
- win.document.write('<P ALIGN="CENTER">\n');
- win.document.write('<IMG SRC="../../../Images/icons/fireworks.gif" BORDER=0>\n');
- win.document.write('</P>\n');
- }
- win.document.write ("Your score is " +
- Math.round(count*100/total) + " %!\n</H2>\n</P><P>\n");
-
- win.document.write("<CENTER>")
- win.document.write("<FORM>");
- win.document.write("<TABLE BORDER=5 CELLPADDING=10>");
- win.document.write("<TR><TD ALIGN=\"CENTER\">");
- win.document.write("<INPUT TYPE=button VALUE=\"Close\" onClick=\"window.close()\"></TD></TR>");
- win.document.write("</TABLE>");
- win.document.write("</FORM>");
- win.document.write("</CENTER>");
- if (count < total) {
- win.document.write ("<CENTER>\n</P><P><P><BR><BR><BR>\n");
- win.document.write ("Stars are next to the correct answers.</P><P>\n");
- win.document.write ("</CENTER>\n");
- }
-
- win.document.write('</BODY>\n</HTML>\n');
- }
-